package com.thoughtworks.android.androsphere.service.c2dm;

import java.io.InputStream;
import java.util.Map;

import org.apache.log4j.Logger;

import com.thoughtworks.util.http.HttpResponseHandler;

public class C2DMServiceResponseHandler implements HttpResponseHandler {
    private static final Logger logger = Logger.getLogger(C2DMServiceResponseHandler.class);

    private Map<Integer, ResponseCallBack> callBackMap;

    public C2DMServiceResponseHandler(Map<Integer, ResponseCallBack> callBackMap) {
        this.callBackMap = callBackMap;
    }

    public void handle(int responseCode, Map<String, String> headers, InputStream inputStream) {
        logger.debug("Inside the handle of C2DMServiceResponseHandler, with response code :" + responseCode);
        callBackMap.get(responseCode).execute(headers, inputStream);
    }
}
